<div class="actions">
<h3><?php __ ( 'Home' );?></h3>
<ul>

	<li><?php
	if($this->Session->Read('user.name') != "" ){
		echo __("Welcome"." ".$this->Session->Read("user.name"));
		if($this->Session->Read('user.level') == 1){
			echo $this->Html->link ( __( 'Users', true ), array ('controller' => 'users', 'action' => 'index' ) );
			echo $this->Html->link ( __( 'Students', true ), array ('controller' => 'students', 'action' => 'index' ) );
			echo $this->Html->link ( __( 'Supervisors', true ), array ('controller' => 'supervisors', 'action' => 'index' ) );
			echo $this->Html->link ( __( 'Companies', true ), array ('controller' => 'companies', 'action' => 'index' ) );
		} else if ($this->Session->Read('user.level') == 0){
			echo $this->Html->link ( __( 'Start Internship Process', true ), array ('controller' => 'internships', 'action' => 'beggin' ) );
		}
		echo $this->Html->link ( __( 'Logout', true ), array ('action' => 'logout' ) );
	} else {
			echo $this->Html->link ( __( 'Login', true ), array ('action' => 'login' ) );
		if($this->Session->Read('user.level') == ''){
			echo $this->Html->link ( __( 'Sign up', true ), array ('action' => 'add' ) );
		}
	}
	?></li>
</ul>
</div>
<div class="students form">
	<h2><?php	__( 'Internships Opportunities' );?></h2>
	<?php if($this->Session->Read('user.level')):?>
		<h5 class="actions">
			<?php echo $this->Html->link(__('Add Opportunity', true), array('controller'=>'opportunities', 'action' => 'add')); ?>
		</h5>
		<br/>
	<?php endif;?>
	<table cellpadding="0" cellspacing="0">
		<?php
		foreach ( $Opportunities as $id => $opp ) :
			$title = $opp['Opportunity']['title'];
			$id = $opp['Opportunity']['id'];
			$date = $opp['Opportunity']['date'];
			$date = substr($date, 8, 2)."-".substr($date, 5, 2)."-".substr($date, 0, 4);
			?>
		<tr>
			<td><?php echo $this->Html->link($title, array('action' => 'view', $id, 'controller' => 'opportunities'))." - ".$date; ?></td>
			<?php if($this->Session->Read('user.level')):?>
				<td class="actions" style="text-align: right;">
				<?php echo $this->Html->link(__('Edit', true), array('controller'=>'opportunities', 'action' => 'edit', $id)); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller'=>'opportunities', 'action' => 'delete', $id), null, sprintf(__('Are you sure you want to delete # %s?', true), $id)); ?>
				</td>
			<?php endif;?>
		</tr>
		<?php endforeach;?>
	</table>
<br />
<div style="clear: both;"></div>
<dl>
<dt>
<?php echo $this->Html->link(__('Show all opportunities', true), array('controller'=>'opportunities', 'action' => 'index'));?>
</dl>
</div>